<?php

namespace Admin\Controller;

class EchartsController extends CommonController
{
    /**
     * 男女会员性别统计
     */
    public function sex_total()
    {
        $data = [
            ['value' => $this->customer->where('sex = 1')->count(), 'name' => '男'],
            ['value' => $this->customer->where('sex = 0')->count(), 'name' => '女']
        ];
        $this->ajaxReturn($data);
    }

    /**
     * 会员省份分布统计
     */
    public function province_total()
    {
        $data = $this->customer->query("select province as name,count(*) as value from customer group by province");
        $this->ajaxReturn($data);
    }

}